# Table 1
# =======================================================================================

# Calculate descriptive statistics
# =======================================================================================


# submissions
tab.sub <- count(filter(manuscript_data, is.na(gender_type3) == FALSE), gender_type3) %>% 
  mutate(tot = sum(n), prop = n/tot*100) %>%
  mutate(type = "Authorship")

# reviewer invites
tab.rev <- count(filter(reviewer_invitations, is.na(r_gender) == FALSE), r_gender) %>% 
  mutate(tot = sum(n), prop = n/tot*100) %>%
  mutate(type = "Invited Reviewers")

# submitting reviewers
tab.rev2 <- count(filter(reviewer_data, is.na(r_gender) == FALSE & is.na(recommendation) == FALSE), r_gender) %>% 
  mutate(tot = sum(n), prop = n/tot*100) %>%
  mutate(type = "Submitting Reviewers")

# combine 
tab.des <- bind_rows(tab.sub, tab.rev, tab.rev2)

tab.des <- tab.des %>% mutate(gender_type = ifelse(is.na(gender_type3) == T, r_gender, gender_type3))

tab.des <- tab.des %>% select(type, gender_type, n, tot, prop)

# save
print(xtable(tab.des),include.rownames = FALSE , file = here("02_output", "01_tables", "table1.tex"))


